home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / gamesmaster / demosrc / heightchange.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  4.4 KB  |  152 lines

  1. ;Height Change
  2. ;-------------
  3. ;Just a test routine for height and width alteration.  Move the joystick
  4. ;up and left to see the screen change.
  5. ;
  6. ;Press fire to exit.
  7.  
  8.     opt    o+
  9.  
  10.     INCLUDE    "exec/exec_lib.i"
  11.     INCLUDE    "games/games_lib.i"
  12.     INCLUDE    "games/games.i
  13.  
  14. CALL    MACRO
  15.     jsr    _LVO\1(a6)
  16.     ENDM
  17.  
  18. LOCAL    =    1
  19.  
  20.     SECTION    "HeightChange",CODE
  21.  
  22. ;===========================================================================;
  23. ;                             INITIALISE DEMO
  24. ;===========================================================================;
  25.  
  26. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  27.     move.l    ($4).w,a6
  28.     lea    GMS_Name(pc),a1
  29.     moveq    #$00,d0
  30.     CALL    OpenLibrary
  31.     move.l    d0,GMS_Base
  32.     beq    Quit
  33.  
  34.     move.l    GMS_Base(pc),a6
  35.     CALL    SetUserPri
  36.  
  37.     move.l    GMS_Base(pc),a6          ;Tell GMS that we want to add a
  38.     lea    ScreenStruct(pc),a0      ;screen for use.
  39.     CALL    Add_Screen
  40.     tst.l    d0
  41.     bne.s    Error
  42.  
  43.     move.l    SS_MemPtr1(a0),a1        ;Destination = SS_MemPtr1.
  44.     lea    PackedPicFile(pc),a0     ;File Name.
  45.     CALL    QuickLoad
  46.     tst.l    d0
  47.     beq.s    Error
  48.  
  49.     lea    ScreenStruct(pc),a0      ;Unpack the data on top of itself.
  50.     move.l    SS_MemPtr1(a0),a1
  51.     move.l    a1,a0
  52.     moveq    #$00,d0
  53.     CALL    SmartUnpack
  54.  
  55.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  56.     CALL    Show_Screen
  57.  
  58. ;===========================================================================;
  59. ;                                MAIN LOOP
  60. ;===========================================================================;
  61.  
  62. Loop:    moveq    #JPORT2,d0               ;Read from port 2
  63.         moveq   #JT_SWITCH,d1
  64.     CALL    Read_JoyPort             ;Go get joystick status.
  65.     btst    #JS_FIRE1,d0
  66.     bne.s    Fade_Here
  67.  
  68. .TRight    btst    #JS_RIGHT,d0             ;This is the routine that moves
  69.     beq.s    .TLeft                   ;the screen routine around.  All
  70.     addq.w    #1,SS_Scr_Width(a0)      ;it does is change the X/Y co-ords
  71. .TLeft    btst    #JS_LEFT,d0              ;for the top of the screen.
  72.     beq.s    .TUp                     ;Calling Reposition_Screen will
  73.     subq.w    #1,SS_Scr_Width(a0)      ;then update these changes.
  74. .TUp    btst    #JS_UP,d0
  75.     beq.s    .TDown
  76.     subq.w    #1,SS_Scr_Height(a0)
  77. .TDown    btst    #JS_DOWN,d0
  78.     beq.s    .done
  79.     addq.w    #1,SS_Scr_Height(a0)
  80.  
  81. .done    CALL    Wait_OSVBL               ;Always wait for a VBL first.
  82.     CALL    Remake_Screen            ;Reposition the screen now.
  83.     bra.s    Loop
  84.  
  85. Fade_Here:
  86. .Fade    CALL    Wait_OSVBL               ;Keep looping until the fade is
  87.     CALL    B12_FadeToBlack          ;completely finished (ie all
  88.     tst.w    d0                       ;colours are black).
  89.     bne.s    .Fade
  90.  
  91.     moveq    #25,d0                   ;Wait 1/2 second before we exit.
  92.     CALL    Wait_Time
  93.  
  94. ;===========================================================================;
  95. ;                              RETURN TO DOS
  96. ;===========================================================================;
  97.  
  98.     CALL    Delete_Screen            ;Give back screen memory etc.
  99. Error    move.l    GMS_Base(pc),a1
  100.     move.l    ($4).w,a6
  101.     CALL    CloseLibrary
  102. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  103.     moveq    #$00,d0
  104.     rts
  105.  
  106. ;===========================================================================;
  107. ;                           CODE-RELATIVE DATA
  108. ;===========================================================================;
  109.  
  110. GMS_Name:
  111.     dc.b    "games.library",0
  112.     even
  113. GMS_Base:
  114.     dc.l    0
  115.  
  116. AMT_PLANES =    5
  117.  
  118. ScreenStruct:
  119.     dc.l    "GSV1"
  120.     dc.l    0,0,0                    ;Screen_Mem1/2/3
  121.     dc.l    0                        ;Screen link.
  122.     dc.l    ScreenPalette            ;Address of screen palette
  123.     dc.l    0                        ;Address of rasterlist.
  124.     dc.l    0                        ;Amt of colours in palette.
  125.     dc.w    256,320,320/8            ;Screen Height, Width, Width/8
  126.     dc.w    256,320,320/8            ;Pic Height, Width, Width/8
  127.     dc.w    AMT_PLANES               ;Amt_Planes
  128.     dc.w    0,0                      ;Top Of Screen offset, X/Y
  129.     dc.w    0                        ;Scroll buffer in pixels/8.
  130.     dc.w    0                        ;X counter (for hor. scrolling).
  131.     dc.w    0                        ;Y counter (for ver. scrolling).
  132.     dc.l    NOBURST                  ;Special attributes.
  133.     dc.w    LORES                    ;Screen mode.
  134.     dc.b    INTERLEAVED              ;Screen type
  135.     dc.b    0                        ;Screen Is Being Displayed?
  136.     dc.l    0,0                      ;Reserved area.
  137.     even
  138.  
  139. ScreenPalette:
  140.     dc.w    $0000,$0A77,$0B88,$0866,$0A98,$0877,$0B99,$0CBB
  141.     dc.w    $0ABB,$0CCC,$0333,$0554,$0556,$0665,$0788,$0222
  142.     dc.w    $0466,$0345,$0677,$0888,$0234,$0322,$0844,$0733
  143.     dc.w    $0632,$0955,$09AA,$0022,$0832,$0943,$0DCC,$0DDD
  144.  
  145. PackedPicFile:
  146.     IFNE    LOCAL
  147.     dc.b    "GAMESLIB:"
  148.     ENDC
  149.     dc.b    "data/Pic320.pak",0
  150.     even
  151.  
  152.